/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package consumo.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Carlos Taschetto
 */
@Entity
@Table(name = "mm_listagem", catalog = "consumodb", schema = "")
@NamedQueries({
    @NamedQuery(name = "MmListagem.findAll", query = "SELECT m FROM MmListagem m"),
    @NamedQuery(name = "MmListagem.findById", query = "SELECT m FROM MmListagem m WHERE m.id = :id"),
    @NamedQuery(name = "MmListagem.findByMomento", query = "SELECT m FROM MmListagem m WHERE m.momento = :momento"),
    @NamedQuery(name = "MmListagem.findByKW", query = "SELECT m FROM MmListagem m WHERE m.kW = :kW"),
    @NamedQuery(name = "MmListagem.findByKVAr", query = "SELECT m FROM MmListagem m WHERE m.kVAr = :kVAr"),
    @NamedQuery(name = "MmListagem.findByCanal3", query = "SELECT m FROM MmListagem m WHERE m.canal3 = :canal3")})
public class MmListagem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "momento", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date momento;
    @Column(name = "kW")
    private Integer kW;
    @Column(name = "kVAr")
    private Integer kVAr;
    @Column(name = "canal3")
    private Integer canal3;
    @JoinColumn(name = "mm_cabecalho", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private MmCabecalho mmCabecalho;

    public MmListagem() {
    }

    public MmListagem(Integer id) {
        this.id = id;
    }

    public MmListagem(Integer id, Date momento) {
        this.id = id;
        this.momento = momento;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getMomento() {
        return momento;
    }

    public void setMomento(Date momento) {
        this.momento = momento;
    }

    public Integer getKW() {
        return kW;
    }

    public void setKW(Integer kW) {
        this.kW = kW;
    }

    public Integer getKVAr() {
        return kVAr;
    }

    public void setKVAr(Integer kVAr) {
        this.kVAr = kVAr;
    }

    public Integer getCanal3() {
        return canal3;
    }

    public void setCanal3(Integer canal3) {
        this.canal3 = canal3;
    }

    public MmCabecalho getMmCabecalho() {
        return mmCabecalho;
    }

    public void setMmCabecalho(MmCabecalho mmCabecalho) {
        this.mmCabecalho = mmCabecalho;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MmListagem)) {
            return false;
        }
        MmListagem other = (MmListagem) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "consumo.persistence.MmListagem[id=" + id + "]";
    }

}
